package com.itheima.service.store;

import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;

import java.io.FileOutputStream;

public class sheetOut {
    public static void main(String[] args) throws Exception {
        Workbook wb = new XSSFWorkbook();
        Sheet sheet = wb.createSheet();
        for (int i = 0; i < 9; i++) {
            Row row = sheet.createRow(i);
            for (int j = 0; j < i; j++) {
                Cell cell = row.createCell(j);
                cell.setCellValue(j + " * " + i + " = " + (j*i));
            }
        }

        FileOutputStream fos = new FileOutputStream("乘法表.xlsx");
        wb.write(fos);

        fos.close();
        wb.close();

    }
}
